home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 227_01 / dos.mac < prev    next >
Text File  |  1988-02-07  |  6KB  |  332 lines

  1. ;--------------------------------------------------------------------------
  2. ;     d o s . m a c
  3. ;       -------------
  4. ;    Macro file to define some system constants (like memory-model).
  5. ;
  6. ;    release history
  7. ;    ---------------
  8. ;    Jun, 14. 1987    First version written.
  9. ;
  10. ;    Written by     Rainer Gerhards
  11. ;            Petronellastr. 6
  12. ;            D-5112 Baesweiler
  13. ;            Phone (49) 2401 - 1601
  14. ;--------------------------------------------------------------------------
  15.  
  16. ;
  17. ;    Define Memory-model to use
  18. ;    --------------------------
  19. ;    Equate the memory model to use to 1, all others to 0.
  20. ;
  21. S_MODEL    equ    1
  22. D_MODEL    equ    0
  23. P_MODEL    equ    0
  24. L_MODEL    equ    0
  25.  
  26. ;
  27. ;    Define C-compiler to use
  28. ;    ------------------------
  29. ;    Equate the label, that describes your C-compiler to his current
  30. ;    version (major version number * 10 + 1st digit of minor version
  31. ;    number). All other lables must be equated to 0.
  32. ;    Currently only the below listed compilers are supported!
  33. ;
  34. LC    equ    0            ; Lattice C
  35. DLC    equ    0            ; Dataligth C
  36. MSC    equ    0            ; Microsoft C
  37. TC    equ    1            ; Borland Turbo C
  38.  
  39. ;
  40. ;    ----------------------------------------------------------------------
  41. ;    End of configurable parameters.
  42. ;    ----------------------------------------------------------------------
  43. ;    The following macros and equs are internal to the graphics library and
  44. ;    shouldn't be modified by the user.
  45. ;    They are subject to change without notice!
  46. ;    ----------------------------------------------------------------------
  47. ;
  48.  
  49. VERSION    equ    20            ; graphic library version
  50.  
  51.     if1
  52.     %out    Graphlib Version 2.0, written by Rainer Gerhards.
  53.     %out
  54.     endif
  55. ;
  56. ;    compiler and memory model cross-check
  57. ;
  58.     if1
  59.     ife    S_MODEL or P_MODEL or D_MODEL or L_MODEL
  60.       %out    Error: no memory-model specified!
  61.     endif
  62.  
  63.     if    S_MODEL
  64.       if    P_MODEL or D_MODEL or L_MODEL
  65.        %out    Error: multiple memory models can't be selected in one pass!
  66.       endif
  67.       %out    Info: S model selected.
  68.     endif
  69.  
  70.     if    D_MODEL
  71.       if    S_MODEL or P_MODEL or L_MODEL
  72.        %out    Error: multiple memory models can't be selected in one pass!
  73.       endif
  74.       %out    Info: D model selected.
  75.     endif
  76.  
  77.     if    P_MODEL
  78.       if    S_MODEL or D_MODEL or L_MODEL
  79.        %out    Error: multiple memory models can't be selected in one pass!
  80.       endif
  81.       %out    Info: P model selected.
  82.     endif
  83.  
  84.     if    L_MODEL
  85.       if    S_MODEL or D_MODEL or P_MODEL
  86.        %out    Error: multiple memory models can't be selected in one pass!
  87.       endif
  88.       %out    Info: L model selected.
  89.     endif
  90.  
  91.     ife    DLC or LC or MSC or TC
  92.       %out    Error: no C-compiler specified!
  93.     endif
  94.  
  95.     if    LC
  96.       if    DLC or MSC or TC
  97.        %out    Error: multiple compilers aren't supported in one pass!
  98.       endif
  99.       %out    Info: Lattice C compiler selected.
  100.     endif
  101.  
  102.     if    DLC
  103.       if    LC or MSC or TC
  104.        %out    Error: multiple compilers aren't supported in one pass!
  105.       endif
  106.       %out    Info: Dataligth C compiler selected.
  107.     endif
  108.  
  109.     if    MSC
  110.       if    LC or DLC or TC
  111.        %out    Error: multiple compilers aren't supported in one pass!
  112.       endif
  113.       %out    Info:    Microsoft C compiler selected.
  114.       %out    Warning: MSC is currently not implemented!
  115.     endif
  116.  
  117.     if    TC
  118.       if    LC or DLC or MSC
  119.        %out    Error: multiple compilers aren't supported in one pass!
  120.       endif
  121.       %out    Info: Borland's Turbo C compiler selected.
  122.     endif
  123.  
  124.     endif    ; if1
  125. ;
  126. ;    define macros and system-constants
  127. ;
  128.  
  129.     if    P_MODEL or L_MODEL
  130. LPROG    equ    1
  131.     else
  132. LPROG    equ    0
  133.     endif
  134.  
  135.     if    D_MODEL or L_MODEL
  136. LDATA    equ    1
  137.     else
  138. LDATA    equ    0
  139.     endif
  140.  
  141. SETX    macro
  142.     if    LPROG
  143. X    equ    6
  144.     else
  145. X    equ    4
  146.     endif
  147.     endm
  148.  
  149. ;
  150. ;    begin/end Data segment
  151. ;
  152.  
  153.     if    DLC or LC
  154.  
  155. DSEG    macro    
  156. DGROUP    group    DATA
  157. DATA    segment word public 'DATA'
  158.     assume    DS:DGROUP
  159.     endm
  160.  
  161. ENDDS    macro
  162. DATA    ends
  163.     endm
  164.  
  165.     endif    ; if DLC or LC
  166.  
  167.     if    MSC or TC
  168.  
  169. DSEG    macro    
  170. _data    segment word public 'data'
  171.     assume    DS:_data
  172.     endm
  173.  
  174. ENDDS    macro
  175. _data    ends
  176.     endm
  177.  
  178.     endif    ; if MSC or TC
  179.  
  180. ;
  181. ;    begin/end code segment
  182. ;
  183.  
  184.     if    DLC or LC
  185.  
  186.     if    S_MODEL
  187. PSEG    macro
  188. PGROUP    group    PROG
  189. PROG    segment    byte public 'PROG'
  190.     assume    CS:PGROUP
  191.     endm
  192. ENDPS    macro
  193. PROG    ends
  194.     endm
  195.     endif
  196.  
  197.     if    D_MODEL
  198. PSEG    macro
  199. CGROUP    group    CODE
  200. CODE    segment    byte public 'CODE'
  201.     assume    CS:CGROUP
  202.     endm
  203. ENDPS    macro
  204. CODE    ends
  205.     endm
  206.     endif
  207.  
  208.     if    P_MODEL
  209. PSEG    macro
  210. _CODE    segment    byte public 'CODE'
  211.     assume  CS:_CODE
  212.     endm
  213. ENDPS    macro
  214. _CODE    ends
  215.     endm
  216.     endif
  217.  
  218.     if    L_MODEL
  219. PSEG    macro
  220. _PROG    segment    byte public 'PROG'
  221.     assume    CS:_PROG
  222.     endm
  223. ENDPS    macro
  224. _PROG    ends
  225.     endm
  226.     endif
  227.  
  228.     endif    ; if DLC or LC
  229.  
  230.     if    MSC or TC
  231.  
  232.     if    S_MODEL
  233. PSEG    macro
  234. _TEXT    segment    byte public 'CODE'
  235.     assume    CS:_TEXT
  236.     endm
  237. ENDPS    macro
  238. _TEXT    ends
  239.     endm
  240.     endif
  241.  
  242.     if    D_MODEL or P_MODEL or L_MODEL 
  243. PSEG    macro
  244. ASM_TEXT segment byte public 'CODE'
  245.     assume    CS:ASM_TEXT
  246.     endm
  247. ENDPS    macro
  248. ASM_TEXT ends
  249.     endm
  250.     endif
  251.  
  252.     endif    ; if DLC or LC
  253.  
  254. ;
  255. ;    Begin a function macro.
  256. ;
  257. BEGIN    macro    fnam
  258.     if    DLC or LC
  259.       public  fnam
  260.     endif
  261.     if    MSC or TC
  262.       public  _&fnam
  263.     endif
  264.     if    LPROG
  265.       if    DLC or LC
  266. fnam       proc    far
  267.       endif        
  268.       if    MSC or TC
  269. _&fnam       proc    far
  270.       endif        
  271.     else
  272.       if    DLC or LC
  273. fnam       proc    near
  274.       endif
  275.       if    MSC or TC
  276. _&fnam       proc    near
  277.       endif
  278.     endif
  279.     endm
  280.  
  281. ;
  282. ;    end a function macro
  283. ;
  284.  
  285. ENDFUNC    macro    fnam
  286.     if    DLC or LC
  287. fnam    endp
  288.     endif
  289.     if    MSC or TC
  290. _&fnam    endp
  291.     endif
  292.     endm
  293.  
  294. ;
  295. ;    enter a function macro
  296. ;
  297.  
  298. ENTERF    macro
  299.     push    bp
  300.     mov    bp, sp
  301.     if    MSC or TC
  302.       push    di
  303.       push    si
  304.     endif
  305.     endm
  306.  
  307. ;
  308. ;    leave a function macro
  309. ;
  310.  
  311. LEAVEF    macro
  312.     if    MSC or TC
  313.       pop    si
  314.       pop    di
  315.     endif
  316.     pop    bp
  317.     ret
  318.     endm
  319.  
  320. ;
  321. ;    define external item
  322. ;
  323. EXTERN    macro    name, val, alias
  324.     if    MSC or TC
  325.     extrn    _&name:val
  326. alias    equ    _&name
  327.     else
  328.     extrn    name:val
  329. alias    equ    name
  330.     endif
  331.     endm
  332.